import java.sql.ResultSet

fun ResultSet.getLongOrNull(colNum: Int): Long? {
    val value = getLong(colNum)
    return if (this.wasNull()) null else value
}

fun ResultSet.getIntOrNull(colNum: Int): Int? {
    val value = getInt(colNum)
    return if (this.wasNull()) null else value
}

fun ResultSet.getShortOrNull(colNum: Int): Short? {
    val value = getShort(colNum)
    return if (this.wasNull()) null else value
}

fun ResultSet.getBooleanOrNull(colNum: Int): Boolean? {
    val value = getBoolean(colNum)
    return if (this.wasNull()) null else value
}

fun ResultSet.getByteOrNull(colNum: Int): Byte? {
    val value = getByte(colNum)
    return if (this.wasNull()) null else value
}

fun ResultSet.getDoubleOrNull(colNum: Int): Double? {
    val value = getDouble(colNum)
    return if (this.wasNull()) null else value
}

fun ResultSet.getFloatOrNull(colNum: Int): Float? {
    val value = getFloat(colNum)
    return if (this.wasNull()) null else value
}